package com.aaa.mrcai.controller;

import com.aaa.mrcai.annotion.AAALog;
import com.aaa.mrcai.pojo.vo.GoodsCategoryVo;
import com.aaa.mrcai.query.GoodsCategoryQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.GoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Demo class
 *
 * @Author: Wang
 * @Date: Created in 19:43 2021/12/6
 */
@RestController
@RequestMapping("goodsCategory")
public class GoodsCategoryController {
    @Autowired
    public GoodsCategoryService goodsCategoryService;

    @RequestMapping("list")
    public AjaxResult list(GoodsCategoryQuery query){
        return goodsCategoryService.list(query);
    }

    @RequestMapping("addGoodsCategory")
    @AAALog("添加商品品种")
    public AjaxResult addGoodsCategory (GoodsCategoryVo goodsCategoryVo){
        return goodsCategoryService.addGoodsCategory(goodsCategoryVo);
    }

    @RequestMapping("/getGoodsCategory/{id}")
    public AjaxResult getGoodsCategory (@PathVariable("id") int id ){
        return goodsCategoryService.getGoodsCategory(id);
    }

    @RequestMapping("updateGoodsCategory")
    @AAALog("修改商品品种")
    public AjaxResult updateGoodsCategory (GoodsCategoryVo goodsCategoryVo){
        return goodsCategoryService.updateGoodsCategory(goodsCategoryVo);
    }

    @RequestMapping("/deleteGoodsCategory/{id}")
    @AAALog("删除商品品种")
    public AjaxResult deleteGoodsCategory (@PathVariable("id") int id ){ return goodsCategoryService.deleteGoodsCategory(id); }

}
